load("//:build_variables.bzl", "COPTS")
load("//tools/lint:linters.bzl", "clang_tidy_test")

package(
    default_visibility = ["//:android_cuttlefish"],
)

proto_library(
    name = "webrtc_commands_proto",
    srcs = ["webrtc_commands.proto"],
    deps = ["@googleapis//google/rpc:status_proto"],
)

cc_proto_library(
    name = "libcuttlefish_webrtc_commands_proto",
    deps = [":webrtc_commands_proto"],
)

cc_library(
    name = "libcuttlefish_webrtc_command_channel",
    srcs = ["webrtc_command_channel.cpp"],
    hdrs = ["webrtc_command_channel.h"],
    copts = COPTS,
    strip_include_prefix = "//cuttlefish",
    deps = [
        ":libcuttlefish_webrtc_commands_proto",
        "//cuttlefish/common/libs/transport",
        "//libbase",
    ],
)

cc_binary(
    name = "webRTC",
    srcs = [
        "adb_handler.cpp",
        "adb_handler.h",
        "audio_handler.cpp",
        "audio_handler.h",
        "bluetooth_handler.cpp",
        "bluetooth_handler.h",
        "client_server.cpp",
        "client_server.h",
        "connection_observer.cpp",
        "connection_observer.h",
        "cvd_video_frame_buffer.cpp",
        "cvd_video_frame_buffer.h",
        "display_handler.cpp",
        "display_handler.h",
        "gpx_locations_handler.cpp",
        "gpx_locations_handler.h",
        "kernel_log_events_handler.cpp",
        "kernel_log_events_handler.h",
        "kml_locations_handler.cpp",
        "kml_locations_handler.h",
        "location_handler.cpp",
        "location_handler.h",
        "main.cpp",
        "screenshot_handler.cpp",
        "screenshot_handler.h",
        "sensors_handler.cpp",
        "sensors_handler.h",
    ],
    copts = COPTS,
    deps = [
        ":libcuttlefish_webrtc_command_channel",
        ":libcuttlefish_webrtc_commands_proto",
        "//cuttlefish/common/libs/fs",
        "//cuttlefish/common/libs/sensors",
        "//cuttlefish/common/libs/transport",
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:json",
        "//cuttlefish/common/libs/utils:result",
        "//cuttlefish/common/libs/utils:size_utils",
        "//cuttlefish/host/commands/kernel_log_monitor:kernel_log_monitor_utils",
        "//cuttlefish/host/frontend/webrtc/libcommon",
        "//cuttlefish/host/frontend/webrtc/libdevice",
        "//cuttlefish/host/libs/audio_connector",
        "//cuttlefish/host/libs/config:config_constants",
        "//cuttlefish/host/libs/config:config_utils",
        "//cuttlefish/host/libs/config:cuttlefish_config",
        "//cuttlefish/host/libs/config:logging",
        "//cuttlefish/host/libs/config:openwrt_args",
        "//cuttlefish/host/libs/confui:host_confui",
        "//cuttlefish/host/libs/input_connector",
        "//cuttlefish/host/libs/location",
        "//cuttlefish/host/libs/screen_connector",
        "//cuttlefish/host/libs/screen_connector:video_frame_buffer",
        "//cuttlefish/host/libs/vm_manager",
        "//libbase",
        "@fmt",
        "@fruit",
        "@gflags",
        "@googleapis//google/rpc:code_cc_proto",
        "@googleapis//google/rpc:status_cc_proto",
        "@jsoncpp",
        "@libdrm//:libdrm_fourcc",
        "@libjpeg_turbo//:jpeg",
        "@libpng",
        "@libwebrtc",
        "@libwebsockets",
        "@libyuv",
    ],
)

clang_tidy_test(
    name = "webRTC_clang_tidy",
    srcs = [":webRTC"],
    tags = [
        "clang-tidy",
        "clang_tidy",
    ],
)
